package com.hc.sss.llz.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hc.sss.common.ResultMap;
import com.hc.sss.pojo.SuggestionFeedback;
import com.hc.sss.pojo.User;
import com.hc.sss.service.SuggestionFeedbackService;

@RequestMapping("feedback")
@Controller
public class SuggestionFeedbackController {

	@Autowired
	SuggestionFeedbackService suggestionFeedbackService;
	
	//lcx
	@RequestMapping("/add")
	@ResponseBody
	public int addSuggestionFeedback(SuggestionFeedback suggestionFeedback,HttpServletRequest request) {
		User user=(User) request.getSession().getAttribute("user");
		suggestionFeedback.setSfUserId(user.getUserId());
		return suggestionFeedbackService.insertSuggestionFeedback(suggestionFeedback);
	}
	
	//查询所有意见反馈分页
	@RequestMapping("/findSuggestionFeedbackLisr")
	@ResponseBody
	public ResultMap<SuggestionFeedback> findSuggestionFeedbackLisr(SuggestionFeedback suggestionFeedback,Integer page,Integer limit) {
		Map<String, Object> paramMap = new HashMap<>();
		paramMap.put("page", page);
		paramMap.put("limit", limit);
		paramMap.put("suggestionFeedback", suggestionFeedback);
		ResultMap<SuggestionFeedback> resultMap = suggestionFeedbackService.findSuggestionFeedbackLisr(paramMap);
		return resultMap;
	}
	
	@RequestMapping("/deleteSuggestionFeedback")
	@ResponseBody
	public int deleteSuggestionFeedback(Integer sfId) {
		return suggestionFeedbackService.deleteSuggestionFeedback(sfId);
	}
	
	
	
}
